<template>
	<view class='my-wallet'>
		<block v-if="show">
			<view class='money'>
				<image src="https://jiajudashi.oss-cn-shenzhen.aliyuncs.com/images/shop/icons/wallet/bg.png" mode="widthFix" class="bg"></image>
				<image src="https://jiajudashi.oss-cn-shenzhen.aliyuncs.com/images/shop/icons/wallet/shadow.png" mode="widthFix" class="shadow"></image>
				<view class="money-info">
					<view class='money_tit'>账户余额（元）</view>
					<view class='money_num'>
						{{data.money}}
						<!-- <view class="btn" @click='goApplyWithdrawal()'>
							去提现
							<u-icon name="arrow-right" color="#141414" size="28"></u-icon>
						</view> -->
					</view>
				</view>
			</view>
			<view class='list'>
				<view class='item' @click='goAllDetail()'>
					<view class='item_lf'>
						<image src='https://jiajudashi.oss-cn-shenzhen.aliyuncs.com/images/shop/icons/wallet/icon1.png'></image>
					</view>
					<view class='item_middel'>钱包明细</view>
					<view class='item_rt'></view>
				</view>
				<!-- <view class='item' @click='GocashRecord'>
					<view class='item_lf'>
						<image src='https://jiajudashi.oss-cn-shenzhen.aliyuncs.com/images/shop/icons/wallet/icon2.png'></image>
					</view>
					<view class='item_middel'>提现记录</view>
					<view class='item_rt'></view>
				</view>
				<view class='item' @click='goBindAlipay'>
					<view class='item_lf'>
						<image src='https://jiajudashi.oss-cn-shenzhen.aliyuncs.com/images/shop/icons/wallet/icon3.png'></image>
					</view>
					<view class='item_middel'>支付宝</view>
					<view class="item_rt" :class='[data.alipay_sn == "" ? "" : "hui"]'>{{data.alipay_sn == "" ? '去绑定': data.alipay_sn}}</view>
				</view> -->
				<view class='item' @click='goUpdataPwd(data.privat_key)'>
					<view class='item_lf'>
						<image src='https://jiajudashi.oss-cn-shenzhen.aliyuncs.com/images/shop/icons/wallet/icon4.png'></image>
					</view>
					<view class='item_middel'>支付密码</view>
					<view class="item_rt" :class='[data.privat_key == "" ? "" : "hui"]'>{{data.privat_key == '' ? '去设置' : '去修改'}}</view>
				</view>
			</view>
		</block>
		<pt-loading></pt-loading>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				data: '',
				show: false
			};
		},
		onLoad(options) {},
		onShow() {
			this.init()
		},
		methods: {
			init() {
				this.$u.api.MyWallet().then(res => {
					this.data = res.datas
					this.show = true
				})
			},
			goApplyWithdrawal() {
				uni.navigateTo({
					animationDuration: 500,
					url: '/my/my-wallet/apply-withdrawal/apply-withdrawal'
				})
			},
			goBindAlipay() {
				uni.navigateTo({
					animationDuration: 500,
					url: '/my/my-wallet/bind-alipay/bind-alipay'
				})
			},
			goUpdataPwd(privat_key) {
				if (privat_key != '') {
					// 修改密码
					uni.navigateTo({
						animationDuration: 500,
						url: '/my/my-wallet/updata-pwd/updata-pwd?type=1'
					})
				} else {
					uni.navigateTo({
						animationDuration: 500,
						url: '/my/my-wallet/updata-pwd/updata-pwd?type=0'
					})
				}

			},
			goAllDetail() {
				uni.navigateTo({
					animationDuration: 500,
					url: '/my/my-wallet/cash-details/cash-details'
				})
			},
			GocashRecord() {
				uni.navigateTo({
					animationDuration: 500,
					url: '/my/my-wallet/cash-record/cash-record'
				})
			}
		}
	}
</script>

<style lang="scss">
	.my-wallet {
		padding: 30rpx;
		.money {
			position: relative;
			.bg{
				width: 100%;
				position: relative;
				z-index: 5;
			}
			.shadow{
				position: absolute;
				width: 678rpx;
				height: 130rpx;
				bottom: -65rpx;
				left: 50%;
				transform: translateX(-50%);
			}
			.money-info{
				position: absolute;
				top: 50%;
				left: 50rpx;
				right: 50rpx;
				color: #FFF;
				transform: translateY(-50%);
				z-index: 6;
			}
		}
		.money_tit {
			font-size: 28rpx;
		}
		.money_num {
			font-size: 56rpx;
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			.btn{
				font-size: 28rpx;
				color: #141414;
				width: 156rpx;
				height: 56rpx;
				line-height: 56rpx;
				text-align: center;
				background-color: #FFF;
				border-radius: 8rpx;
				/deep/ .u-icon{
					margin-left: 5rpx;
				}
			}
		}
		.list {
			background-color: #fff;
			padding-top: 50rpx;
			margin: 0 -30rpx;
		}

		.item {
			display: flex;
			font-size: 34rpx;
			color: #141414;
			align-items: center;
			border-bottom: 1rpx solid #f9f9f9;
			height: 140rpx;
			padding: 0 30rpx;
			font-weight: bold;
			box-shadow: 0px 10rpx 40rpx 0px rgba(20, 20, 20, 0.03);
		}

		.item:last-child {
			border-bottom: 0;
		}

		.item_lf image {
			width: 44rpx;
			height: 44rpx;
			display: block;
			margin-right: 24rpx;
		}

		.item .item_middel {
			flex: 1;
			line-height: 24rpx;
		}

		.item_rt {
			position: relative;
			padding: 0 30rpx;
			font-weight: 100;
			font-size: 28rpx;
			color: #A4A4A4;
		}

		.item_rt::after {
			position: absolute;
			top: 10rpx;
			right: 0;
			display: block;
			content: "";
			width: 12rpx;
			height: 12rpx;
			border-top: 1rpx solid #C1C1C1;
			border-right: 1rpx solid #C1C1C1;
			border-left: 1rpx solid transparent;
			border-bottom: 1rpx solid transparent;
			transform: rotate(45deg)
		}

		.hui {
			color: #C1C1C1;
		}

	}
</style>
